package com.example.service;

import com.example.entity.*;
import jakarta.servlet.http.HttpSession;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserService {
    void commit();
    void rollback();
    //登录
    boolean auth(String u_account, String u_password, HttpSession session);
    User getUser(String account, String password);
    String getHashedPasswordByAccount(String account);
    User getUserByAccount(String u_account);

    Passenger getPassengerByIDtypeAndIDcard(String ID_type, String ID_card);
    int addUser(String name, String sex, String ID_type, String ID_card, String account, String password, String phone, String birthday,String create_date);
    int getUidByIDcard(String ID_card);
    Integer getPidByUid(int u_id);
    //int addPassenger(String name, String sex, String ID_card);
    //int getOrderNumByPid(int p_id);
    //void updatePassengerOrderNum(int order_num);
    int addBank(String u_name,String ID_type, String u_ID_card);

    int isExistByAccount(String account);
    int isExistByIDcardAndIDtype(String IDtype, String ID_card);
    int isExistByPhone(String account);
    int isExistByEmail(String email);
    int updateUser(String name, String sex, String ID_card, String account, String password, String phone,String city);
    //修改个人信息
    int updatePassword(String password, String account);
    //注销
    int deleteUser(int u_id);
    List<Ticket> getTicketListByOrderId(int o_id);
    int addEconomySpace(int f_id);
    int addBusinessSpace(int f_id);
    int addFirstSpace(int f_id);
    int deleteTicket(int t_id);
    int deleteOrderById(int o_id);
    int deleteOrder(int u_id);
    int addBankMoneyByUserIDtypeAndIDcard(String ID_type, String ID_card, double money);
    List<Ticket> getTicketListByPassengerId(int passenger_id);
    Order getOrderById(int o_id);
    User getUserById(int u_id);
    int updateOrderPriceAndPassengerNum(int o_id, double price);
    int deletePassenger(int passenger_id);

    //订单
    List<Order> getOrderListByUserId(int userId);
    int getOrderNumByUserId(int userId);
    int getUnpaidOrderNum(int userId);
    int getPaidOrderNum(int userId);
    int getCancelledOrderNum(int userId);
    int getCompletedOrderNum(int userId);
    int getRefundOrderNum(int userId);

    //机票
    List<TicketDetail> getTicketDetailsListByPassengerId(int passenger_id);
    int getTicketNumByPassengerId(int passenger_id);
    int getUpcomingTicketNumByPassengerId(int passenger_id);
    int getCompletedTicketNumByPassengerId(int passenger_id);
    int getCancelledTicketNumByPassengerId(int passenger_id);
    int getPlannedTicketNumByPassengerId(int passenger_id);
    int getUnpaidTicketNumByPassengerId(int passenger_id);
    int getRefundTicketNumByPassengerId(int passenger_id);
    int getDelayTicketNumByPassengerId(int passenger_id);

    //预定机票
    Flight getFlightById(int f_id);
    int isTicketExist(int p_id, int f_id);
    FlightBooking getFlightBookingByFid(int f_id);
    FlightStatus getFlightStatusById(int f_id);
    int getLastOrderId();
    int addOrder(int o_id,int userId, String user_name, int flightNo, String airline, String date, String from, String to, String departure, String arrival, double price, int passengers, String status, String statusText, String paymentMethod, String paymentDate);
    double getEconomyPrice(int f_id);
    double getEconomyChildPriceByFid(int f_id);
    double getEconomySeniorPriceByFid(int f_id);
    double getEconomyInfantPriceByFid(int f_id);
    double getBusinessPriceByFid(int f_id);
    double getBusinessChildPriceByFid(int f_id);
    double getBusinessSeniorPriceByFid(int f_id);
    double getBusinessInfantPriceByFid(int f_id);
    double getFirstPriceByFid(int f_id);
    double getFirstChildPriceByFid(int f_id);
    double getFirstSeniorPriceByFid(int f_id);
    double getFirstInfantPriceByFid(int f_id);
    double getBankMoneyByUserIDtypeAndIDcard(String ID_type, String ID_card);
    int updateBankMoneyByUserIDtypeAndIDcard(String ID_type, String ID_card, double money);
    int isPassengerExistByIDtypeAndIDcard(String ID_type, String ID_card);
    int updatePassengerOrderNum(String ID_type, String ID_card);
    int addPassenger(String name, String sex, String ID_type, String ID_card, String birthday);
    int updateEconomySpace(int f_id);
    int updateBusinessSpace(int f_id);
    int updateFirstSpace(int f_id);
    int getPassengerIdByIDtypeAndIDcard(String ID_type, String ID_card);
    int addTicket(int order_id, int passenger_id, String passenger_name, String passenger_type, int flightNo, String date, double price, String seat_type, String status, String statusText);

    //绑定邮箱
    String getEmailByUserId(int u_id);
    int updateEmail(int u_id, String email);
}
